Optimal. Leaf size=140 \[ \left (a^3 c-3 a b^2 c-3 a^2 b d+b^3 d\right ) x-\frac {\left (3 a^2 b c-b^3 c+a^3 d-3 a b^2 d\right ) \log (\cos (e+f x))}{f}+\frac {b \left (2 a b c+a^2 d-b^2 d\right ) \tan (e+f x)}{f}+\frac {(b c+a d) (a+b \tan (e+f x))^2}{2 f}+\frac {d (a+b \tan (e+f x))^3}{3 f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.11, antiderivative size = 140, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 3, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {3609, 3606,
3556} \begin {gather*} \frac {b \left (a^2 d+2 a b c-b^2 d\right ) \tan (e+f x)}{f}-\frac {\left (a^3 d+3 a^2 b c-3 a b^2 d-b^3 c\right ) \log (\cos (e+f x))}{f}+x \left (a^3 c-3 a^2 b d-3 a b^2 c+b^3 d\right )+\frac {(a d+b c) (a+b \tan (e+f x))^2}{2 f}+\frac {d (a+b \tan (e+f x))^3}{3 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3606
Rule 3609
Rubi steps
\begin {align*} \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x)) \, dx &=\frac {d (a+b \tan (e+f x))^3}{3 f}+\int (a+b \tan (e+f x))^2 (a c-b d+(b c+a d) \tan (e+f x)) \, dx\\ &=\frac {(b c+a d) (a+b \tan (e+f x))^2}{2 f}+\frac {d (a+b \tan (e+f x))^3}{3 f}+\int (a+b \tan (e+f x)) \left (a^2 c-b^2 c-2 a b d+\left (2 a b c+a^2 d-b^2 d\right ) \tan (e+f x)\right ) \, dx\\ &=\left (a^3 c-3 a b^2 c-3 a^2 b d+b^3 d\right ) x+\frac {b \left (2 a b c+a^2 d-b^2 d\right ) \tan (e+f x)}{f}+\frac {(b c+a d) (a+b \tan (e+f x))^2}{2 f}+\frac {d (a+b \tan (e+f x))^3}{3 f}+\left (3 a^2 b c-b^3 c+a^3 d-3 a b^2 d\right ) \int \tan (e+f x) \, dx\\ &=\left (a^3 c-3 a b^2 c-3 a^2 b d+b^3 d\right ) x-\frac {\left (3 a^2 b c-b^3 c+a^3 d-3 a b^2 d\right ) \log (\cos (e+f x))}{f}+\frac {b \left (2 a b c+a^2 d-b^2 d\right ) \tan (e+f x)}{f}+\frac {(b c+a d) (a+b \tan (e+f x))^2}{2 f}+\frac {d (a+b \tan (e+f x))^3}{3 f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 1.11, size = 130, normalized size = 0.93 \begin {gather*} \frac {3 (a+i b)^3 (-i c+d) \log (i-\tan (e+f x))+3 (a-i b)^3 (i c+d) \log (i+\tan (e+f x))+6 b \left (3 a b c+3 a^2 d-b^2 d\right ) \tan (e+f x)+3 b^2 (b c+3 a d) \tan ^2(e+f x)+2 b^3 d \tan ^3(e+f x)}{6 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.09, size = 159, normalized size = 1.14
method | result | size |
norman | \(\left (a^{3} c -3 a^{2} b d -3 a \,b^{2} c +b^{3} d \right ) x +\frac {b \left (3 a^{2} d +3 a b c -b^{2} d \right ) \tan \left (f x +e \right )}{f}+\frac {b^{2} \left (3 a d +b c \right ) \left (\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {b^{3} d \left (\tan ^{3}\left (f x +e \right )\right )}{3 f}+\frac {\left (a^{3} d +3 a^{2} b c -3 a \,b^{2} d -b^{3} c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}\) | \(141\) |
derivativedivides | \(\frac {\frac {b^{3} d \left (\tan ^{3}\left (f x +e \right )\right )}{3}+\frac {3 a \,b^{2} d \left (\tan ^{2}\left (f x +e \right )\right )}{2}+\frac {b^{3} c \left (\tan ^{2}\left (f x +e \right )\right )}{2}+3 a^{2} b d \tan \left (f x +e \right )+3 a \,b^{2} c \tan \left (f x +e \right )-b^{3} d \tan \left (f x +e \right )+\frac {\left (a^{3} d +3 a^{2} b c -3 a \,b^{2} d -b^{3} c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{3} c -3 a^{2} b d -3 a \,b^{2} c +b^{3} d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) | \(159\) |
default | \(\frac {\frac {b^{3} d \left (\tan ^{3}\left (f x +e \right )\right )}{3}+\frac {3 a \,b^{2} d \left (\tan ^{2}\left (f x +e \right )\right )}{2}+\frac {b^{3} c \left (\tan ^{2}\left (f x +e \right )\right )}{2}+3 a^{2} b d \tan \left (f x +e \right )+3 a \,b^{2} c \tan \left (f x +e \right )-b^{3} d \tan \left (f x +e \right )+\frac {\left (a^{3} d +3 a^{2} b c -3 a \,b^{2} d -b^{3} c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{3} c -3 a^{2} b d -3 a \,b^{2} c +b^{3} d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) | \(159\) |
risch | \(a^{3} c x -3 a^{2} b d x -3 a \,b^{2} c x +b^{3} d x +3 i a^{2} b c x +\frac {2 i a^{3} d e}{f}-3 i a \,b^{2} d x -\frac {2 i b^{3} c e}{f}-i b^{3} c x +i a^{3} d x -\frac {6 i a \,b^{2} d e}{f}+\frac {2 i b \left (9 a^{2} d \,{\mathrm e}^{4 i \left (f x +e \right )}+9 a b c \,{\mathrm e}^{4 i \left (f x +e \right )}-6 b^{2} d \,{\mathrm e}^{4 i \left (f x +e \right )}-9 i a b d \,{\mathrm e}^{4 i \left (f x +e \right )}-3 i b^{2} c \,{\mathrm e}^{4 i \left (f x +e \right )}+18 a^{2} d \,{\mathrm e}^{2 i \left (f x +e \right )}+18 a b c \,{\mathrm e}^{2 i \left (f x +e \right )}-6 b^{2} d \,{\mathrm e}^{2 i \left (f x +e \right )}-9 i a b d \,{\mathrm e}^{2 i \left (f x +e \right )}-3 i b^{2} c \,{\mathrm e}^{2 i \left (f x +e \right )}+9 a^{2} d +9 a b c -4 b^{2} d \right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}+\frac {6 i a^{2} b c e}{f}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a^{3} d}{f}-\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a^{2} b c}{f}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a \,b^{2} d}{f}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) b^{3} c}{f}\) | \(383\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.54, size = 153, normalized size = 1.09 \begin {gather*} \frac {2 \, b^{3} d \tan \left (f x + e\right )^{3} + 3 \, {\left (b^{3} c + 3 \, a b^{2} d\right )} \tan \left (f x + e\right )^{2} + 6 \, {\left ({\left (a^{3} - 3 \, a b^{2}\right )} c - {\left (3 \, a^{2} b - b^{3}\right )} d\right )} {\left (f x + e\right )} + 3 \, {\left ({\left (3 \, a^{2} b - b^{3}\right )} c + {\left (a^{3} - 3 \, a b^{2}\right )} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 6 \, {\left (3 \, a b^{2} c + {\left (3 \, a^{2} b - b^{3}\right )} d\right )} \tan \left (f x + e\right )}{6 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.13, size = 151, normalized size = 1.08 \begin {gather*} \frac {2 \, b^{3} d \tan \left (f x + e\right )^{3} + 6 \, {\left ({\left (a^{3} - 3 \, a b^{2}\right )} c - {\left (3 \, a^{2} b - b^{3}\right )} d\right )} f x + 3 \, {\left (b^{3} c + 3 \, a b^{2} d\right )} \tan \left (f x + e\right )^{2} - 3 \, {\left ({\left (3 \, a^{2} b - b^{3}\right )} c + {\left (a^{3} - 3 \, a b^{2}\right )} d\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 6 \, {\left (3 \, a b^{2} c + {\left (3 \, a^{2} b - b^{3}\right )} d\right )} \tan \left (f x + e\right )}{6 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.15, size = 240, normalized size = 1.71 \begin {gather*} \begin {cases} a^{3} c x + \frac {a^{3} d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {3 a^{2} b c \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - 3 a^{2} b d x + \frac {3 a^{2} b d \tan {\left (e + f x \right )}}{f} - 3 a b^{2} c x + \frac {3 a b^{2} c \tan {\left (e + f x \right )}}{f} - \frac {3 a b^{2} d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {3 a b^{2} d \tan ^{2}{\left (e + f x \right )}}{2 f} - \frac {b^{3} c \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {b^{3} c \tan ^{2}{\left (e + f x \right )}}{2 f} + b^{3} d x + \frac {b^{3} d \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac {b^{3} d \tan {\left (e + f x \right )}}{f} & \text {for}\: f \neq 0 \\x \left (a + b \tan {\left (e \right )}\right )^{3} \left (c + d \tan {\left (e \right )}\right ) & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 2046 vs.
\(2 (140) = 280\).
time = 1.35, size = 2046, normalized size = 14.61 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 5.27, size = 141, normalized size = 1.01 \begin {gather*} x\,\left (c\,a^3-3\,d\,a^2\,b-3\,c\,a\,b^2+d\,b^3\right )-\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (b^3\,d-3\,a\,b\,\left (a\,d+b\,c\right )\right )}{f}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {c\,b^3}{2}+\frac {3\,a\,d\,b^2}{2}\right )}{f}+\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (\frac {d\,a^3}{2}+\frac {3\,c\,a^2\,b}{2}-\frac {3\,d\,a\,b^2}{2}-\frac {c\,b^3}{2}\right )}{f}+\frac {b^3\,d\,{\mathrm {tan}\left (e+f\,x\right )}^3}{3\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________